package top.swimmer.tools.data.sort;

import java.util.Random;

public class SortTest {
    public static void main(String[] args) {
        System.out.println("begin load arrays!");
        int[] array1 = new int[10000];
        int[] array2 = new int[10000];
        Random random = new Random();
        for (int i = 0; i < 10000; i++) {
            int num = random.nextInt(10000);
            array1[i] = num;
            array2[i] = num;
        }
        System.out.println("load arrays finish!");
        long start1 = System.currentTimeMillis();
        QuickSort.quickSort(array2, 0, array2.length - 1);
        long end1 = System.currentTimeMillis();
        System.out.println(end1 - start1);

        long start = System.currentTimeMillis();
        BubbleSort.bubbleSort(array1);
        long end = System.currentTimeMillis();
        System.out.println(end - start);

        for (int i = 0; i < 10000; i++) {
            if (array1[i] != array2[i]) {
                System.out.println("error.");
            }
        }
    }
}
